-
-
Notifications
You must be signed in to change notification settings - Fork 145
Add check assert_type to tests for frame.py and add __new__ method for DatetimeIndex #1313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for doing this. Caught a few things that we should clean up as a result.
pandas-stubs/core/frame.pyi
Outdated
class _iAtIndexerFrame(_iAtIndexer, Generic[_T]): | ||
def __getitem__(self, idx: tuple[int, int]) -> Scalar: ... | ||
def __setitem__( | ||
self, | ||
idx: tuple[int, int], | ||
value: Scalar | NAType | NaTType | None, | ||
) -> None: ... | ||
|
||
class _AtIndexerFrame(_AtIndexer, Generic[_T]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since none of the methods in either of these refer to _T
, you can remove the Generic
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I had duplicated the _LocIndexerFrame and was removing unused section but forgot about it.
pandas-stubs/core/frame.pyi
Outdated
def at(self): ... # Not sure what to do with this yet; look at source | ||
def at( | ||
self, | ||
) -> _AtIndexerFrame: ... # Not sure what to do with this yet; look at source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment
pandas-stubs/core/frame.pyi
Outdated
def iat(self): ... # Not sure what to do with this yet; look at source | ||
def iat( | ||
self, | ||
) -> _iAtIndexerFrame: ... # Not sure what to do with this yet; look at source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment
tests/test_frame.py
Outdated
df7: pd.DataFrame = pd.DataFrame({"x": [1, 2, 3]}, index=pd.Index(["a", "b", "c"])) | ||
index: pd.Index = pd.Index(["b"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove the : pd.DataFrame
and : pd.Index
from this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @loicdiridollou
Cleaned up tests in tests/test_frame.py as there was no check assert_type in many places.
Added a new method for DatetimeIndex since it would not instantiate to DatetimeIndex but to Series[int].
assert_type()
to assert the type of any return value